﻿using System;
using System.Text;
using Portal.Core;
using System.Collections.ObjectModel;
using Portal.Exam.Bussiness;
using Portal.Exam.Model;
using System.Data;

namespace Portal.Exam.Render
{
    public class ExamTemplateSubModulePermission : PermissionModuleTemplate
    {
        public override string ServiceId
        {
            get
            {
                return "ExamTemplateSubModulePermission";
            }
        }

        public override string ServiceName
        {
            get
            {
                return "Phân quyền cho mẫu đề thi";
            }
        }

        public override Collection<PermissionItemListCls> GetPermissionItemLists(string SiteId)
        {
            Collection<PermissionItemListCls>
                PermissionItemLists = new Collection<PermissionItemListCls> { };

            DataTable dtExamTemplate = new ExamTemplateBll().ReadingExamTemplate(SiteId, "","1");

            for (int iIndex = 0; iIndex < dtExamTemplate.Rows.Count; iIndex++)
            {
                string ExamTemplateId = (string)dtExamTemplate.Rows[iIndex]["ExamTemplateId"];
                string ExamTemplateName = (string)dtExamTemplate.Rows[iIndex]["ExamTemplateName"];

                PermissionItemListCls OPermissionItemList = new PermissionItemListCls();
                OPermissionItemList.subject = ExamTemplateName;
                OPermissionItemList.id = ExamTemplateId;
                OPermissionItemList.ptc = ExamTemplatePermission.StaticId;
                PermissionItemLists.Add(OPermissionItemList);
            }
            return PermissionItemLists;
        }
    }
}
